<!--
@author     Yi Bo <etng2004@gmail.com>
@version    $Id: contacthistory_list.php 59 2007-09-10 03:35:38Z etng2004 $
@copyrithg  2006-2007 ETE.CN
@license    PHP Version 3.0 {@link http://www.php.net/license/3_0.txt}
-->
<?php
$this->declareVars();
echo $this->render('header.php');
require_once(dirname(__FILE__) . '/_meta_contacthistory.php');
$this->dump($this->contact_histories);
$contact_histories = $this->contact_histories;

/**
 * 列表相应参数
 */
$checkbox_group = 'ContactHistory';
?>
<script type="text/javascript">
<!--
function validateBatchOperateForm(checkboxGroup)
{
	var errors=[];
	if(!checkboxGroup.selected.length)errors.push('请选择至少一个对象！');

	//    var f_status = document.getElementById('field_status');
	//    var v_status = f_status.options[f_status.selectedIndex].value;
	//    if(v_status=="")errors.push('请选择至少一种批量操作！');

	if(errors.length)
	{
		alert("请纠正以下错误后再继续操作：\n\n"+errors.join("\n"));
		return false;
	}
	return true;
}
//-->
</script>
<div id="Whatever">
	<ul class="CategoryListTableLevel1">
	<li><a href="<?php echo $this->base_url; ?>/list/date_region/today">今天</a><i></i></li>
	<li><a href="<?php echo $this->base_url; ?>/list/date_region/yestoday">昨天</a><i></i></li>
	<li><a href="<?php echo $this->base_url; ?>/list/date_region/week">本周</a><i></i></li>
	<li><a href="<?php echo $this->base_url; ?>/list/date_region/month">本月</a><i></i></li>
	<li><a href="<?php echo $this->base_url; ?>/list/">所有</a><i></i></li>
	</ul>
	<div class="HackBox"></div>
</div>


<table cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td><!--表头区域，可以用来做搜索等信息的展示-->
    </td>
  </tr>
  <tr>
    <td align="center" valign="top" width="100%"><form method="post" action="<?php echo $this->base_url; ?>/batchOperate/" id="frmBatchOperate" name="frmBatchOperate" onsubmit="return validateBatchOperateForm(<?php echo $checkbox_group;?>ChkGroup);">
        <table cellspacing="0" cellpadding="0" id="<?php echo strtolower($checkbox_group);?>_list" class="tblborder" width="100%">
          <tr class="tblhead">
            <td> - </td>
            <td><?php echo $meta['contact_history']['fields']['id'];?> </td>
            <td><?php echo $meta['contact_history']['fields']['contact_by'];?> </td>
            <td><?php echo $meta['contact_history']['fields']['conclusion'];?> </td>
            <td><?php echo $meta['contact_history']['fields']['contact_at'];?> </td>
            <td> 操作 </td>
          </tr>
          <?php
        if(!$contact_histories):
    ?>
          <tr class="tblbody">
            <td colspan="20"><div class="Tips"> 此客户暂时没有联系记录，请赶快联系客户并 <a href=" <?php echo $this->module_url;?>/contactHistory/add/client/<?php echo $this->client['id'] ?>">添加第一条联系记录</a> </div></td>
          </tr>
          <?php
        else:
        foreach ($contact_histories as $contact_history):
    ?>
          <tr class="tblbody">
            <td><input type="checkbox" name="fields[<?php echo strtolower($checkbox_group);?>_id][]" id="fields_<?php echo strtolower($checkbox_group);?>_<?php echo $contact_history['id']; ?>" value="<?php echo $contact_history['id']; ?>"/>
            </td>
            <td><?php echo $contact_history['id']; ?></td>
            <td><?php echo $LANG['CONTACT_BY'][$contact_history['contact_by']]; ?></td>
            <td><?php echo $contact_history['conclusion']; ?></td>
            <td><?php echo $this->dateFormat($contact_history['contact_at']); ?></td>
            <td><a href=" <?php echo $this->base_url;?>/view/id/<?php echo $contact_history['id'] ?>">查看</a> <a href=" <?php echo $this->base_url;?>/edit/id/<?php echo $contact_history['id'] ?>">编辑</a> <a href=" <?php echo $this->base_url;?>/remove/id/<?php echo $contact_history['id'] ?>">删除</a> </td>
          </tr>
          <?php
        endforeach;
    ?>
          <tr class="tblfoot">
            <td colspan="20"><a href="javascript:void(0);" onclick="<?php echo $checkbox_group;?>ChkGroup.all();">全选</a> <a href="javascript:void(0);" onclick="<?php echo $checkbox_group;?>ChkGroup.inverse();">反选</a> <a href="javascript:void(0);" onclick="<?php echo $checkbox_group;?>ChkGroup.clear();">不选</a> 对选中的对象：
              <select name="operate[status]" id="field_status">
                <option value="">===审核===</option>
                <?php
$lang_status_op = array();
foreach ($lang_status_op as $status => $text) {
	if($this->status==$status)continue;
	echo "<option value=\"{$status}\">{$text}</option>\n";
}
  ?>
              </select>
              <input type="submit" value="设置"  />
            </td>
          </tr>
          <tr class="tblfoot">
            <td colspan="20" align="right"><?php
          echo $this->pagination($this->pager['total'], $this->pager['curpage'], $this->pager['perpage'], $this->pager['url'] );
?>
            </td>
          </tr>
          <?php
        endif;
    ?>
        </table>
      </form>
      <script type="text/javascript">
      <!--
      var <?php echo $checkbox_group;?>ChkGroup = new EtCheckboxes('<?php echo strtolower($checkbox_group);?>_list','fields_<?php echo strtolower($checkbox_group);?>_',[]);
      //-->
</script>
    </td>
  </tr>
  <tr>
    <td>others</td>
  </tr>
</table>
<?php
echo $this->render('footer.php');
?>